import time
from selenium import webdriver

url = 'http://bj.58.com/?utm_source=market&spm=u-2d2yxv86y3v43nkddh1.BDPCPZ_BT'
driver = webdriver.Chrome(executable_path=r'E:\ChromeDriver\chromedriver_win32/chromedriver.exe')

# 设置打开的浏览器全屏
driver.maximize_window()

driver.get(url)

# 拖动滚动条
# selenium不能对页面进行滚动，需要执行js的滚动事件让页面进行滚动
js = 'scrollTo(0, 500)'
driver.execute_script(js)

time.sleep(3)

# 获取元素，执行点击事件
el_button = driver.find_element_by_xpath('/html/body/div[3]/div[1]/div[1]/div/div[1]/div[2]/em[7]/a')
el_button.click()

time.sleep(5)
driver.quit()



